package com.lucy.rabc.domain.converter;

import com.lucy.common.utils.JsonUtil;
import com.lucy.rabc.domain.extend.PostExtend;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;
import javax.persistence.Converter;

/**
 *
 */

@Converter
public class PostExtendConverter implements AttributeConverter<PostExtend,String> {
    @Override
    public String convertToDatabaseColumn(PostExtend postExtend) {
        return JsonUtil.obj2String(postExtend);
    }

    @Override
    public PostExtend convertToEntityAttribute(String s) {
        return JsonUtil.string2Obj(s,PostExtend.class);
    }
}
